using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MimeCloud.AssetManagement.Business.Interface;

using MimeCloud.AssetManagement.DataProvider.Astoria.Entities.Data;
using System.Data.Linq.Mapping;
using System.Data.Linq;


namespace MimeCloud.AssetManagement.DataProvider.Astoria.Entities.Data
{
    [Table(Name="T_AssetContent")]
    public class AssetContent
    {
        public AssetContent()
        {
            _Language = new EntityRef<Language>();
            _status = new EntityRef<Status>();
            _AssetContentType = new EntityRef<AssetContentType>();
            _MimeType = new EntityRef<MimeType>();
            _Asset = new EntityRef<Asset>();
            //Asset = asset;
            _metadata = new EntitySet<AssetContentMetadata>();
            
            
            _repositoryLinks = new EntitySet<AssetContent_Repository>();
        }

        [Column(Name="CreationDate_DT",IsDbGenerated=true)]
        public DateTime CreationDate {get;set;}
        [Column(Name="CreatorID_NVC")]
        public string CreatorID { get; set; }

        internal int _id;

        [Column(Name="AssetContent_IDPK",IsPrimaryKey=true,IsDbGenerated=true,Storage="_id")]
        public int ID
        {
            get { return _id; }
            set { _id = value;
                 }
        }

        [Column(Name="LanguageID_FK")]
        public short LanguageID { get; set; }
        [Column(Name="LatestEditorID_NVC")]
        public string LatestEditorID { get; set; }
        [Column(Name="StatusID_FK")]
        public int StatusID { get; set; }
        [Column(Name="UpdatedDate_DT",IsDbGenerated=true)]
        public DateTime UpdatedDate { get; set; }
        [Column(Name="AssetContentTypeID_FK")]
        public int AssetContentTypeID { get; set; }
        [Column(Name="AssetID_FK")]
        public int AssetID { get; set; }
        [Column(Name="AssetPath_NVC")]
        public string AssetPath { get; set; }
        [Column(Name="MimeTypeID_FK")]
        public int MimeTypeID { get; set; }
        
        [Association(IsForeignKey=true,ThisKey="LanguageID",OtherKey="ID",Storage="_Language")]
        private Language LanguageE { get { return _Language.Entity; } set { _Language.Entity = value; } }
        internal EntityRef<Language> _Language;

        [Association(ThisKey = "StatusID",OtherKey="ID", Storage = "_status", IsForeignKey = true)]
        private Status StatusE { get { return _status.Entity; } set { _status.Entity = value; } }
        internal EntityRef<Status> _status;

        [Association(IsForeignKey=true,DeleteOnNull=false,Storage="_AssetContentType",ThisKey="AssetContentTypeID",OtherKey="ID")]
        private AssetContentType AssetContentTypeE { get { return _AssetContentType.Entity; } set { _AssetContentType.Entity = value; } }
        internal EntityRef<AssetContentType> _AssetContentType;
  
        [Association(IsForeignKey=true,DeleteOnNull=false,Storage="_MimeType",ThisKey="MimeTypeID",OtherKey="ID")]
        private MimeType MimeTypeE { get { return _MimeType.Entity; } set { _MimeType.Entity = value; } }
        internal EntityRef<MimeType> _MimeType;

        [Association(Storage="_Asset",IsForeignKey=true,ThisKey="AssetID",OtherKey="ID")]
        private Asset AssetE { get { return _Asset.Entity; } set { _Asset.Entity = value; } }
        internal EntityRef<Asset> _Asset;

        [Association(OtherKey = "AssetContentID",ThisKey="ID", Storage = "_metadata", IsForeignKey=true)]
        private IList<AssetContentMetadata> AssetMetaDataListCast { get { return _metadata; } set { _metadata.Assign(value); } }
        internal EntitySet<AssetContentMetadata> _metadata;

        [Association(OtherKey="AssetContentID",ThisKey="ID",Storage="_repositoryLinks",IsForeignKey=true,DeleteRule="Cascade")]
        internal EntitySet<AssetContent_Repository> RepositoryLinks { get { return _repositoryLinks; } set { _repositoryLinks.Assign(value); } }    
        internal EntitySet<AssetContent_Repository> _repositoryLinks;
    }
}
